calculate the mode of given data